import Vue from 'vue';
import VueRouter from 'vue-router'


const routes = [
    { path: '/', redirect: '/login' },
    { path: '/login', component: () => import('../views/Login.vue') },
    { path: '/home', component: () => import('../views/home/Home.vue'), redirect: '/index',
        children: [
            {
                path: '/index', component: () => import('../views/index/index.vue'), meta: {
                    title: "首页"
                }
            },
            { path: '/bookSearch', component: () => import('../views/book/SearchBook.vue') },
            { path: '/supplierSearch', component: () => import('../views/supplier/SupplierSearch.vue') },
            { path: '/departmentSearch', component: () => import('../views/department/DepartmentSearch.vue') },
            { path: '/userSearch', component: () => import('../views/user/UserSearch.vue') },
            { path: '/borrowSearch', component: () => import('../views/borrow/BorrowSearch.vue') },
            { path: '/orderSearch', component: () => import('../views/order/OrderSearch.vue') },
            { path: '/systemManager', component: () => import('../views/system/SystemManager.vue') },
            // { path: '/rule', component: () => import('@/components/User/Rule.vue') },
            // { path: '/notice', component: () => import('@/components/User/Notice.vue') },
            // { path: '/information', component: () => import('@/components/User/Information.vue') },
            // { path: '/borrow', component: () => import('@/components/User/Borrow.vue') },
            // { path: '/violation', component: () => import('@/components/User/Violation.vue') },
            // { path: '/comment', component: () => import('@/components/User/Comment.vue') },
            // {path:'/intelligent',component:()=>import('@/components/User/Intelligent.vue')}
        ]
    } ,
    {
        path: '/404', component: () => import('@/views/404/404.vue')
    },
    {
        path: '/:pathMatch(.*)*',
        redirect: '/404',
    }
]


Vue.use(VueRouter)
// 3. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
    routes // (缩写) 相当于 routes: routes
})
export default router